package com.zut.service.impl;

import com.zut.dao.ManagerDao;
import com.zut.dao.impl.ManagerDaoImpl;
import com.zut.entity.Manager;
import com.zut.service.ManagerService;

/**
 * 管理员的业务实现类
 */
public class ManagerServiceImpl implements ManagerService {

    //创建一个管理员持久层对象
    private ManagerDao mgDao = new ManagerDaoImpl();

    /**
     * 登录业务
     * @param username
     * @param password
     * @return
     */
    @Override
    public Manager login(String username, String password) {

        //调用持久层方法进行数据库查询
        Manager manager = mgDao.findManagerByUsernameAndPassword(username, password);

        //返回结果给视图层
        return manager;
    }

    /**
     * 修改密码
     * @param username
     * @param newPwd
     */
    @Override
    public void updatePassword(String username, String newPwd) {
        mgDao.updatePassword(username,newPwd);

    }
}
